<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>ZhangTao天下第一帅</title>
    <script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
    <script>
        window.onload =function () {
            $('#login').click(function () {
                $.ajax({
                    url:'/user',
                    data:{act:'login',user:$('#user').val(),pass:$('#pass').val()},
                    type:'GET',
                    success:function(str){
                        debugger
                        str = JSON.parse(str);
                        alert(str.msg);

                    }

                })
            })
            $('#reg').click(function () {
                $.ajax({
                    url:'/user',
                    data:{act:'reg',user:$('#user').val(),pass:$('#pass').val()},
                    type:'GET',
                    success:function(str){
                        str = JSON.parse(str);
                        alert(str.msg);

                    }

                })
            })
        }
    </script>
</head>
<body>
用户名: <input type="text" id="user">
密码: <input type="password" id="pass">
<br>
<button id="login">登录</button>
<button id="reg">注册</button>
</body>
</html>